<?php
	$isAuth = false;
	
	if (isset($_SESSION['login']) && isset($_SESSION['password']) && isset($_SESSION['server'])){
		$isAuth = true;
	} 
	else {
		if (isset($_REQUEST['login']) && isset($_REQUEST['password']) && isset($_REQUEST['server'])){
			if (DBAdmin::getInstance()->connectServer($_REQUEST['login'], $_REQUEST['password'], $_REQUEST['server'])){
				$isAuth = true;
				
				$_SESSION['login'] = $_REQUEST['login'];
				$_SESSION['password'] = $_REQUEST['password'];
				$_SESSION['server'] = $_REQUEST['server'];				
			}
		}
	}
	if (isset($_REQUEST["authExit"])){
		session_destroy();
		// перезагружаем страницу
		header('Location: '. $_SERVER[PHP_SELF]); 
	}
	
?>